package com.tedu.controller;

import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

    @RestController//Controller层的注解，可以接收浏览器发来的请求
    @RequestMapping("/car")//和地址栏里的url匹配
public class CarController4 {
        @RequestMapping("/get1")
    public  String get1(Integer id , String name){
           return "如果让我重新来过"+id+name;
        }
        @RequestMapping("/get2/{id}/{name}")//{id}是restful的特殊语法，从地址栏获取参数id的值
        public  String get2(@PathVariable Integer id,@PathVariable String name){//定义{}里的变量
            return id+name+"你会不会爱我";//对浏览器做出响应，在页面上展示
        }
}
